const express = require('express');
// 路由中间件
const router = express.Router();

// 1.商品good

// http://localhost:2003/goodlist/
router.get('/',(req,res)=>{
    res.send('商品列表');
})

// http://localhost:2003/goodlist/gooditem?name=honor8&price=5998
router.get('/gooditem/',(req,res)=>{
    let {name,price} = req.query;
    console.log(req.query);
    res.send({
        name,
        price
    })
})

// http://localhost:2003/goodlist/gooditem/gid_0
router.post('/gooditem/:id',(req,res)=>{
    let {id} = req.params;
    res.send({
        id
    })
})

module.exports = router;